#include "mainwindow.h"
#include "interface/login.h"
#include "interface/ServiceChoose.h"

#include "socket/protocol/ClientBook.h"
#include <assert.h>

#include "QDebug"

CMainWindow::CMainWindow(interface::IInterface *beginInterface, \
                         QMainWindow *parent)
    : QMainWindow(parent)
{
    m_centerWidget = new CCenterWidget(beginInterface);

    //conncet the change interface signal and slots
    connect(m_centerWidget, SIGNAL(changeCenterWidget()), this, SLOT(changeCenterWidget()));

    //set the first interface
    changeCenterWidget();

    // set the window size to 800*480
    setFixedSize(800, 480);
}

CMainWindow::~CMainWindow()
{
    if (this->m_centerWidget != NULL)
    {
        delete this->m_centerWidget;
        this->m_centerWidget = NULL;
    }
}

void CMainWindow::changeCenterWidget()
{
    this->setCentralWidget(m_centerWidget->getCurrentWidget() );
}


